﻿using System;
namespace Xtee.XteeClient. {
    using global::Producers.Calcdoc.Xtee.Riik.Ee.Producer.Calcdoc;
    using global::Producers.Calcdoc.Xtee.Riik.Ee.Producer.Calcdoc.Messages;
    using global::Xtee.Core;
    using System.Collections.Generic;
    
    
    public class Adapter {
        
        private string _serviceXRoadInstance;
        
        private string _serviceMemberClass;
        
        private string _serviceMemberCode;
        
        private string _serviceSubSystemCode;
        
        private string _protocolVersion = "4.0";
        
        private string _issue;
        
        private Xtee.Core.Client.IXteeCommand _xteeCommand;
        
        public Adapter() : 
                this(new Xtee.Core.Client.XteeCommand(new Xtee.Core.Client.Config.Configuration())) {
        }
        
        public Adapter(Xtee.Core.Client.IXteeCommand command) {
            this._xteeCommand = command;
        }
        
        public virtual string ServiceXRoadInstance {
            get {
                return this._serviceXRoadInstance;
            }
            set {
                this._serviceXRoadInstance = value;
            }
        }
        
        public virtual string ServiceMemberClass {
            get {
                return this._serviceMemberClass;
            }
            set {
                this._serviceMemberClass = value;
            }
        }
        
        public virtual string ServiceMemberCode {
            get {
                return this._serviceMemberCode;
            }
            set {
                this._serviceMemberCode = value;
            }
        }
        
        public virtual string ServiceSubSystemCode {
            get {
                return this._serviceSubSystemCode;
            }
            set {
                this._serviceSubSystemCode = value;
            }
        }
        
        public virtual string ProtocolVersion {
            get {
                return this._protocolVersion;
            }
            set {
                this._protocolVersion = value;
            }
        }
        
        public virtual string Issue {
            get {
                return this._issue;
            }
            set {
                this._issue = value;
            }
        }
        
        public virtual Xtee.Core.Client.IXteeCommand XteeCommand {
            get {
                return this._xteeCommand;
            }
            set {
                this._xteeCommand = value;
            }
        }
        
        public virtual global::Producers.Calcdoc.Xtee.Riik.Ee.Producer.Calcdoc.Messages.IHistoryResponse GetHistory(System.DateTime request) {
            global::Xtee.Core.Envelope.ISoapEnvelope responseEnvelope = _xteeCommand.Execute(new global::Xtee.Core.Envelope.SoapEnvelope("http://producers.calcdoc.xtee.riik.ee/producer/calcdoc", "GetHistory", new Xtee.Core.Envelope.Header.StandardHeader(new Xtee.Core.Envelope.Header.Types.XRoadClientIdentifierType(_xteeCommand.Configuration.XRoadInstance, _xteeCommand.Configuration.MemberClass, _xteeCommand.Configuration.MemberCode, _xteeCommand.Configuration.SubSystemCode), new Xtee.Core.Envelope.Header.Types.XRoadServiceIdentifierType(this.ServiceXRoadInstance, this.ServiceMemberClass, this.ServiceMemberCode, this.ServiceSubSystemCode, "GetHistory", "v1"), null, Xtee.Core.Utils.StringUtils.GenerateNonce(), _xteeCommand.Configuration.UserId, null, this.Issue, this.ProtocolVersion), new global::Producers.Calcdoc.Xtee.Riik.Ee.Producer.Calcdoc.Messages.HistoryRequest(request)));
            return ((global::Producers.Calcdoc.Xtee.Riik.Ee.Producer.Calcdoc.Messages.IHistoryResponse)(responseEnvelope.Body));
        }
        
        public virtual global::Producers.Calcdoc.Xtee.Riik.Ee.Producer.Calcdoc.Messages.IAddResponse Add(global::Producers.Calcdoc.Xtee.Riik.Ee.Producer.Calcdoc.IVariables request) {
            global::Xtee.Core.Envelope.ISoapEnvelope responseEnvelope = _xteeCommand.Execute(new global::Xtee.Core.Envelope.SoapEnvelope("http://producers.calcdoc.xtee.riik.ee/producer/calcdoc", "Add", new Xtee.Core.Envelope.Header.StandardHeader(new Xtee.Core.Envelope.Header.Types.XRoadClientIdentifierType(_xteeCommand.Configuration.XRoadInstance, _xteeCommand.Configuration.MemberClass, _xteeCommand.Configuration.MemberCode, _xteeCommand.Configuration.SubSystemCode), new Xtee.Core.Envelope.Header.Types.XRoadServiceIdentifierType(this.ServiceXRoadInstance, this.ServiceMemberClass, this.ServiceMemberCode, this.ServiceSubSystemCode, "Add", "v1"), null, Xtee.Core.Utils.StringUtils.GenerateNonce(), _xteeCommand.Configuration.UserId, null, this.Issue, this.ProtocolVersion), new global::Producers.Calcdoc.Xtee.Riik.Ee.Producer.Calcdoc.Messages.AddRequest(request)));
            return ((global::Producers.Calcdoc.Xtee.Riik.Ee.Producer.Calcdoc.Messages.IAddResponse)(responseEnvelope.Body));
        }
        
        public virtual global::Producers.Calcdoc.Xtee.Riik.Ee.Producer.Calcdoc.Messages.IMultiplyResponse Multiply(global::Producers.Calcdoc.Xtee.Riik.Ee.Producer.Calcdoc.IVariables request) {
            global::Xtee.Core.Envelope.ISoapEnvelope responseEnvelope = _xteeCommand.Execute(new global::Xtee.Core.Envelope.SoapEnvelope("http://producers.calcdoc.xtee.riik.ee/producer/calcdoc", "Multiply", new Xtee.Core.Envelope.Header.StandardHeader(new Xtee.Core.Envelope.Header.Types.XRoadClientIdentifierType(_xteeCommand.Configuration.XRoadInstance, _xteeCommand.Configuration.MemberClass, _xteeCommand.Configuration.MemberCode, _xteeCommand.Configuration.SubSystemCode), new Xtee.Core.Envelope.Header.Types.XRoadServiceIdentifierType(this.ServiceXRoadInstance, this.ServiceMemberClass, this.ServiceMemberCode, this.ServiceSubSystemCode, "Multiply", "v1"), null, Xtee.Core.Utils.StringUtils.GenerateNonce(), _xteeCommand.Configuration.UserId, null, this.Issue, this.ProtocolVersion), new global::Producers.Calcdoc.Xtee.Riik.Ee.Producer.Calcdoc.Messages.MultiplyRequest(request)));
            return ((global::Producers.Calcdoc.Xtee.Riik.Ee.Producer.Calcdoc.Messages.IMultiplyResponse)(responseEnvelope.Body));
        }
        
        public virtual global::Producers.Calcdoc.Xtee.Riik.Ee.Producer.Calcdoc.Messages.ISubtractResponse Subtract(global::Producers.Calcdoc.Xtee.Riik.Ee.Producer.Calcdoc.IVariables request) {
            global::Xtee.Core.Envelope.ISoapEnvelope responseEnvelope = _xteeCommand.Execute(new global::Xtee.Core.Envelope.SoapEnvelope("http://producers.calcdoc.xtee.riik.ee/producer/calcdoc", "Subtract", new Xtee.Core.Envelope.Header.StandardHeader(new Xtee.Core.Envelope.Header.Types.XRoadClientIdentifierType(_xteeCommand.Configuration.XRoadInstance, _xteeCommand.Configuration.MemberClass, _xteeCommand.Configuration.MemberCode, _xteeCommand.Configuration.SubSystemCode), new Xtee.Core.Envelope.Header.Types.XRoadServiceIdentifierType(this.ServiceXRoadInstance, this.ServiceMemberClass, this.ServiceMemberCode, this.ServiceSubSystemCode, "Subtract", "v1"), null, Xtee.Core.Utils.StringUtils.GenerateNonce(), _xteeCommand.Configuration.UserId, null, this.Issue, this.ProtocolVersion), new global::Producers.Calcdoc.Xtee.Riik.Ee.Producer.Calcdoc.Messages.SubtractRequest(request)));
            return ((global::Producers.Calcdoc.Xtee.Riik.Ee.Producer.Calcdoc.Messages.ISubtractResponse)(responseEnvelope.Body));
        }
    }
}
